import request from '@/utils/request'

// 查询模具资料信息列表
export function listMjmMstr(query) {
  return request({
    url: '/project/mjmMstr/list',
    method: 'get',
    params: query
  })
}

// 查询模具资料信息详细
export function getMjmMstr(mjmId) {
  return request({
    url: '/project/mjmMstr/' + mjmId,
    method: 'get'
  })
}

// 新增模具资料信息
export function addMjmMstr(data) {
  return request({
    url: '/project/mjmMstr',
    method: 'post',
    data: data
  })
}

// 修改模具资料信息
export function updateMjmMstr(data) {
  return request({
    url: '/project/mjmMstr',
    method: 'put',
    data: data
  })
}

// 删除模具资料信息
export function delMjmMstr(mjmId) {
  return request({
    url: '/project/mjmMstr/' + mjmId,
    method: 'delete'
  })
}

// 导出模具资料信息
export function exportMjmMstr(query) {
  return request({
    url: '/project/mjmMstr/export',
    method: 'get',
    params: query
  })
}
//获取定额公差下拉树列表
export function treeSelect(query) {
  return request({
    url: '/project/mjmMstr/treeselect',
    method: 'get',
    params: query
  })
}

export  function listMjmMstrById (id,parentId) {
  return request({
    url: '/project/gclList/mjmMstrById/' + id+'/'+parentId,
    method: 'get',
  })
}
//上传模具资料
export function uploadMjm(data) {
  return request({
    url: '/project/mjmMstr/mjmImageUpload',
    method: 'post',
    data:data
  })
}
// 查询模具资料信息列表
export function listFile(query) {
  return request({
    url: '/project/docList/clickList',
    method: 'get',
    params: query
  })
}

//根据物料代码获取对应模具信息
export function getMjmByWldm(wldm) {
  return request({
    url: '/project/mjmMstr/getMjmByWldm/'+wldm,
    method: 'get'
  })
}

// 根据模具编号或模具名称
export function getMjmByBhOrMc(query) {
  return request({
    url: '/project/mjmMstr/getMjmByMjbhOrMjmc',
    method: 'get',
    params: query
  })
}

// 根据模具编号获取到客户编码和产品名称
export function getMjmByMjbh(query) {
  return request({
    url: '/project/mjmMstr/queryMjmByMjbh',
    method: 'get',
    params: query
  })
}

// 查询日生产等信息
export function listMjmProductionModulus(mjmMjbh, year, month) {
  return request({
    url: '/project/mjmMstr/queryMjmProductionModulus',
    method: 'get',
    params: {
      mjmMjbh: mjmMjbh,
      params: {
        year: year,
        month: month
      }
    }
  })
}

// 返回模具编号字典
export function mjmMjbhDict() {
  return request({
    url: '/project/mjmMstr/mjmMjbhOptions',
    method: 'get'
  })
}

export function getMjmByMjbhOne(query) {
  return request({
    url: '/project/mjmMstr/getMjmByMjbhOne',
    method: 'get',
    params: query
  })
}

// 根据模具编号查询维修和保养信息
export function listRepairAndMaintain(query) {
  return request({
    url: '/project/mjmMstr/getRepairAndMaintain' ,
    method: 'get',
    params: query
  })
}

